import request from '@/utils/request'

// 获取员工参数
export function getEmployeeRequest(data) {
  return request({
    url: 'sys/user',
    params: data
  })
}
// 批量导出员工excel
export function exportEmployeeRequest() {
  return request({
    url: 'sys/user/export',
    responseType: 'blob'
  })
}
// 批量-下载导入员工模板
export function importEmployeeTemRequest() {
  return request({
    url: '/sys/user/import/template',
    responseType: 'blob'
  })
}
// 批量-导入员工(上传excel)
export function uploadEmployeeExcelRequest(data) {
  return request({
    url: '/sys/user/import',
    method: 'post',
    data
  })
}
// 删除员工
export function deleteEmployeeRequest(id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}
// 获取员工详情
export function getEmployeeDetailRequest(id) {
  return request({
    url: `/sys/user/${id}`
  })
}
// 上传员工头像
export function uploadImgRequest(name, data) {
  return request({
    url: `/sys/user/upload/${name}`,
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}
// 编辑员工
export function updateEmployeeRequest(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}
// 新增员工
export function addEmployeeRequest(data) {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}
// 获取-已启用的角色列表
export function getEnabledRoleListRequest() {
  return request({
    url: `/sys/role/list/enabled`,
    method: 'get'
  })
}
// 获取-角色详情
export function getRoleDetailRequest(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'get'
  })
}
// 分配-员工-角色
export function assignRolesRequest(data) {
  return request({
    url: `/sys/user/assignRoles`,
    method: 'put',
    data
  })
}
